<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    console.log("圆周率");
    console.log(Math.PI);

    console.log("生成0-1之间的随机数[0,1)");
    console.log(Math.random()); // 生成0-1之间的随机数[0,1) 可能等于0，但不会等于1

    console.log("向上取整");
    console.log(Math.ceil(1.1)); // c  ceil：装天花板
    console.log(Math.ceil(1.9)); // 向上取整  ceil：装天花板

    console.log("向下取整");
    console.log(Math.floor(1.1)); // 向下取整  ceil：装天花板
    console.log(Math.floor(1.9)); // 向下取整  ceil：装天花板

    // 四舍五入round
    console.log("四舍五入round");
    console.log(Math.round(1.1));
    console.log(Math.round(1.49));
    console.log(Math.round(1.5));
    console.log(Math.round(1.9));
    console.log(Math.round(-1.1));
    console.log(Math.round(-1.5));
    console.log(Math.round(-1.51));

    // 取整函数parseInt()
    console.log("取整函数parseInt()");
    console.log(parseInt(1.2));
    console.log(parseInt("12px"));

    // 最大值max()
    console.log("最大值max");
    console.log(Math.max(1, 2, 3, 4, 5));
    // 最小值min()
    console.log("最小值min");
    console.log(Math.min(1, 2, 3, 4, 5));
    // 绝对值abs()
    console.log("绝对值abs");
    console.log(Math.abs(-1));
    // 幂运算pow()
    console.log("幂运算pow");
    console.log(Math.pow(2, 8));
    // 平方根sqrt()
    console.log("平方根sqrt");
    console.log(Math.sqrt(64));
  </script>
</body>

</html>